<a href="?r=seck/addgoods">商品添加页面</a>
<?php foreach($data as $key=>$v){?>
    <div style="float: left">
        <span>时</span>
        <span>分</span>
        <span>秒</span>

        <p><?=$v['path']?></p>
        <p><?=$v['name']?></p>
        <p><?=$v['price']?></p>
        <button class="but" value="<?=$v['id']?>">抢购</button>
    </div>
<?php } ?>

<script src="jquery-3.3.1.js"></script>
<script>



    $(document).on("click",".but",function(){
        var id = $(this).val()
//        alert(id)
        $.ajax({
            method:"post",
            url:"?r=seck/miaosha",
            dataType:"json",
            data:{
                id:id
            },
            success:function(res){
                console.log(res)
//                alert(res.msg)
            }
        })
    })
</script>